Skip to main content

Modbus Config

Description

Modbus is a widely used communication protocol in industrial automation systems that enables the exchange of data between various devices such as sensors, controllers, and actuators. It operates over serial communication or Ethernet, allowing for reliable and efficient data transmission.

It supports different data types, including discrete inputs, coils, input registers, and holding registers, and offers simplicity, flexibility, and interoperability, making it a popular choice for integrating disparate devices in industrial environments.

Child Tools

Settings

Type

Modbus type TCP/IP or RTU.

Modbus TCP/IP

Modbus TCP/IP is a variant of the Modbus protocol that uses Ethernet (IEEE 802.3) for communication and incorporates the TCP/IP transaction protocol. It is also known as Modbus IP, Modbus Ethernet, and Modbus TCP/IP. Modbus TCP/IP runs on an Ethernet physical layer and uses a 6-byte header to enable routing. The protocol allows for multiple clients and is not limited to 32 devices like RS 485. Modbus TCP/IP requires a switch to connect multiple devices, unlike Modbus RTU, which can daisy-chain all devices together.

Modbus RTU

Modbus RTU is the most common implementation of the Modbus protocol, utilising serial communication media such as RS485, RS422, and RS232. The RTU format follows commands/data with a cyclic redundancy check (CRC) checksum. Standard Modbus RTU node addresses range from 1-255, with 0 being reserved for broadcast messages and write-only.

Device ID

Device ID, also known as the slave ID or unit address, is a unique identifier assigned to each server device in a Modbus network. It ranges from 1 to 1024, allowing up to 1024 servers in a network. The Device ID is used by the Modbus client to direct requests to the appropriate server, ensuring that only the targeted server processes the request

The default device ID is 0.

Host

TCP/IP

Host name, IPV4 or IPV6 address for the server (slave).

Service

TCP/IP

TCP/IP Server communication name/port for the client to connect to (default to 502).

TCP Response timeout

TCP/IP

TCP/IP Server response timeout in milliseconds. Default to 1000 milliseconds.

RTU port

RTP

RTU Client communication port number (COM for Windows and /dev/ttyUSB for Linux).

Baud rate

RTP

RTU Server baud rate. Baud rate is the speed at which bits are transmitted along a communication line. The higher the baud rate, the faster the transmission of data over a network cable or serial line, but more susceptible to the transmission noise corruption.

The available baud rates are 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 56000, 57600, 76800, 115200, 128000, 230400 and 256000.

Data bits

RTP

RTU Server data bits. Data bits are the core elements that make up the data packets. These bits are used to represent information in binary form, with sequences of 1s and 0s transmitted for communication. The number of data bits in a Modbus packet is usually 8, which includes 1 start bit, 7 data bits, and 1 or 2 stop bits.

The available data bits are 5, 6, 7, 8.

Parity

RTP

RTU Server parity. Parity is an error-detection technique to ensure data integrity. It can be even, odd, or none with 1 or 2 stop bits. Parity bits are calculated by counting the number of 1s in a data packet and checking if the count is even or odd. If an odd number of bits (including the parity bit) are transmitted incorrectly, the parity bit will be incorrect, indicating a parity error

The available parity are None, Even and Odd.

Stop bits

RTP

RTU Server stop bits. Stop bits are used in Modbus communication to signify the end of a data packet. They help the receiving devices know when a message is completed and allow for error detection in case of partial messages.

The available stop bits are 1, 2.

Number of connection attempts

Number of connection attempts to the server before giving up. Default to 2.

With setup write

Whether to write the setup to the server during setup. Default to false.

Setup Function code

With setup write

Function code to write the setup to the server, run only once during setup.

The available function codes are:

Function CodeHexDescription
50x05Write Single Coil
60x06Write Single Register
150x0FWrite Multiple Coils
160x10Write Multiple Registers

Setup Starting Address

With setup write

The starting address to write the setup to the server for initialising, run only once during setup.

Setup values

With setup write

The values to write to the server for initialising, run only once during setup.

UI Example

Note: In these examples, all the starting addresses are 1 (0x0001).

picture 1

Write Single Coil

picture 2

Write Single Register

picture 4

Write Multiple Coils

picture 5

Write Multiple Registers